package com.usian.article.job;

import com.usian.article.service.HotArticleService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class HotArticleJob {


    @Autowired
    private HotArticleService hotArticleServiceI;

    /**
     * 每天凌晨1点执行一次
     * @param param
     * @return
     * @throws Exception
     */
    @XxlJob("computeArticleScoreJob")
    public ReturnT<String> computeArticleScoreJob(String param) throws Exception {
        log.info("计算文章分值调度任务开始执行....");
        hotArticleServiceI.computeHotArticle();
        log.info("计算文章分值调度任务执行结束....");
        return ReturnT.SUCCESS;
    }

}
